package com.quiz.bis.service.impl;

import java.util.List;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.quiz.bis.domain.vo.BisKnowPointsVo;
import com.quiz.bis.domain.model.BisKnowPoints;
import com.quiz.common.mybatis.core.page.PageQuery;
import com.quiz.common.mybatis.core.page.TableDataInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.quiz.bis.mapper.BisKnowPointsMapper;
import com.quiz.bis.service.IBisKnowPointsService;

/**
 * 知识点Service业务层处理
 *
 * @author ahuan
 * @date 2025-03-09
 */
@Service
public class BisKnowPointsServiceImpl implements IBisKnowPointsService {
    @Autowired
    private BisKnowPointsMapper bisKnowPointsMapper;

    /**
     * 查询知识点
     *
     * @param id 知识点主键
     * @return 知识点
     */
    @Override
    public BisKnowPointsVo selectBisKnowPointsById(Long id) {
        return bisKnowPointsMapper.selectBisKnowPointsById(id);
    }

    /**
     * 查询知识点列表
     *
     * @param bisKnowPoints 知识点
     * @return 知识点
     */
    @Override
    public TableDataInfo<BisKnowPointsVo> selectBisKnowPointsList(BisKnowPoints bisKnowPoints, PageQuery pageQuery) {
        Page<BisKnowPointsVo> page = bisKnowPointsMapper.selectBisKnowPointsList(pageQuery.build(), bisKnowPoints);
        return TableDataInfo.build(page);
    }

    @Override
    public List<BisKnowPoints> selectBisKnowPointsList(BisKnowPoints bisKnowPoints) {
        return bisKnowPointsMapper.selectBisKnowPointsList(bisKnowPoints);
    }

    /**
     * 新增知识点
     *
     * @param bisKnowPoints 知识点
     * @return 结果
     */
    @Override
    public int insertBisKnowPoints(BisKnowPoints bisKnowPoints) {
        return bisKnowPointsMapper.insert(bisKnowPoints);
    }

    /**
     * 修改知识点
     *
     * @param bisKnowPoints 知识点
     * @return 结果
     */
    @Override
    public int updateBisKnowPoints(BisKnowPoints bisKnowPoints) {
        return bisKnowPointsMapper.updateById(bisKnowPoints);
    }

    /**
     * 批量删除知识点
     *
     * @param ids 需要删除的知识点主键
     * @return 结果
     */
    @Override
    public int deleteBisKnowPointsByIds(Long[] ids) {
        return bisKnowPointsMapper.deleteBisKnowPointsByIds(ids);
    }

    /**
     * 删除知识点信息
     *
     * @param id 知识点主键
     * @return 结果
     */
    @Override
    public int deleteBisKnowPointsById(Long id) {
        return bisKnowPointsMapper.deleteBisKnowPointsById(id);
    }
}
